﻿using System.Data;
using System.Data.SqlClient;

namespace SqlExecHelper
{
        public delegate void BeginTranEvent (IDAL dal);
        public delegate void EndTranEvent (IDAL dal);
        public interface IDAL : System.IDisposable
        {
                string ConName { get; }
                IDAL BeginTrans ();

                event BeginTranEvent TranBegin;

                event EndTranEvent TranEnd;

                void CommitTrans ();
                void BackUpDatabase (string name, string path, string show);
                int ExecuteNonQuery (string sql, params IDataParameter[] param);
                SqlDataReader ExecuteReader (string sql, params IDataParameter[] parameter);
                object ExecuteScalar (string sql, params IDataParameter[] parameter);
                DataRow GetDataRow (string sql, params IDataParameter[] param);
                DataSet GetDataSet (string sql, params IDataParameter[] parameter);
                DataTable GetDataTable (string sql, params IDataParameter[] parameter);
                void InsertTable (DataTable table, SqlBulkCopyOptions options = SqlBulkCopyOptions.Default);
                void RollbackTrans ();
                void DropTable (string tableName);
        }
}